cmake_minimum_required(VERSION 3.14)
project(BrightnessAnalyzer)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# 设置 C++ 标准为 C++17（支持 structured bindings 和 filesystem）
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找 OpenCV
set(OpenCV_DIR "/home/hegang/lib/opencv4.9.0_install/lib/cmake/opencv4")  # Linux
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

# 添加可执行文件
add_executable(${PROJECT_NAME} brightness_analyzer.cpp)

# 链接 OpenCV 库
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})

# 如果使用的是 std::filesystem 并遇到链接错误，可以加上：
if(NOT DEFINED CMAKE_CXX_FLAGS AND UNIX AND NOT APPLE)
    set(CMAKE_CXX_FLAGS "-std=c++17 -lstdc++fs")
endif()
